gdk: Shrink GdkTimeCoord
authorMatthias Clasen <mclasen@redhat.com>
Tue, 9 Jun 2020 17:38:48 +0000 (13:38 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Tue, 9 Jun 2020 17:43:03 +0000 (13:43 -0400)
There is really no need to store 128 doubles as axes,
ever. We can do just fine with 10. At the same time,
add a GdkAxisFlags member, so we can interpret the
values without having to go chasing the right device
for this information.

gdk/gdkdevice.h

index a45a3163fb8acfd3b62b1b4e0abdb7201749ca7c..3dddf1e5343b8f9ea6290eb58d00aa7b506c0242 100644 (file)
@@ -85,22 +85,20 @@ typedef enum {
   GDK_DEVICE_TYPE_FLOATING
 } GdkDeviceType;
 
-/* We don't allocate each coordinate this big, but we use it to
- * be ANSI compliant and avoid accessing past the defined limits.
- */
-#define GDK_MAX_TIMECOORD_AXES 128
 
 /**
  * GdkTimeCoord:
  * @time: The timestamp for this event.
- * @axes: the values of the device’s axes.
+ * @flags: Flags indicating what axes are present
+ * @axes: axis values
  *
  * A #GdkTimeCoord stores a single event in a motion history.
  */
 struct _GdkTimeCoord
 {
   guint32 time;
-  gdouble axes[GDK_MAX_TIMECOORD_AXES];
+  GdkAxisFlags flags;
+  double axes[GDK_AXIS_LAST];
 };
 
 GDK_AVAILABLE_IN_ALL